﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InventoryManagement
{
    public partial class AddOrModifyForm : Form
    {
        public string stock { get; set; }
        public string formula { get; set; }
        public string quantity { get; set; }
        public bool Cancelled { get; set; }

        public AddOrModifyForm()
        {
            InitializeComponent();
            PopulateValues();
            Cancelled = true;
        }

        public void PopulateValues()
        {
            StockNameTextBox.Text = stock;
            StockFormulaTextBox.Text = formula;
            StockQuantityTextBox.Text = quantity;
        }

        public void EditOnlyQuantity()
        {
            StockNameTextBox.ReadOnly = true;
            StockFormulaTextBox.ReadOnly = true;
        }

        private void AddOrModifyButton_Click(object sender, EventArgs e)
        {
            stock = StockNameTextBox.Text;
            formula = StockFormulaTextBox.Text;
            quantity = StockQuantityTextBox.Text;
            Cancelled = false;
            this.Close();
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
